﻿using Dataforge.PrismAvalonExtensions.Regions;
using DryIoc;
using IMS.Views;
using Prism.DryIoc;
using Prism.Ioc;
using Prism.Modularity;
using Prism.Navigation.Regions;
using System.Windows;
using Xceed.Wpf.AvalonDock;
// intelligent manufacturing system智能制造系统
namespace IMS
{
    /// <summary>
    /// App.xaml 的交互逻辑
    /// </summary>
    public partial class App : PrismApplication
    {
        protected override Window CreateShell()
        {
            return Container.Resolve<MainView>();
        }

        //注册导航
        protected override void RegisterTypes(IContainerRegistry containerRegistry)
        {
            //result为true 说明 containerRegistry就是容器
            //var result = object.ReferenceEquals(Container, containerRegistry);
            

            //以下两种都可以
            //containerRegistry.RegisterForNavigation<ToDoView, ToDoViewModel>();       
            //containerRegistry.RegisterForNavigation<ToDoView>();
        }

        protected override IModuleCatalog CreateModuleCatalog()
        {
            return new DirectoryModuleCatalog() { ModulePath = @".\Plugins" };
        }

        protected override void ConfigureRegionAdapterMappings(RegionAdapterMappings regionAdapterMappings)
        {
            base.ConfigureRegionAdapterMappings(regionAdapterMappings);
            //给DockingManager注册一个区域适配器
            regionAdapterMappings.RegisterMapping(typeof(DockingManager), Container.Resolve<DockingManagerRegionAdapter>());
        }
    }
}
